﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="WantedList.aspx.cs" Inherits="Default2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div id="detail" style="width: 100%">
        <asp:DropDownList ID="ddlDetail" runat="server" AutoPostBack="True" 
            onselectedindexchanged="ddlDetail_SelectedIndexChanged">
            <asp:ListItem Value="0">關鍵字</asp:ListItem>
            <asp:ListItem Value="1">物品名稱</asp:ListItem>
        </asp:DropDownList>
        <asp:TextBox ID="tbkey" runat="server"></asp:TextBox>
        <asp:Button ID="btnKey" runat="server" Text="搜尋" onclick="btnKey_Click" />
        <div id="divDetail" runat="server" style="display: none;">
            <asp:SqlDataSource ID="SDSGC1" runat="server" ConnectionString="<%$ ConnectionStrings:projectConnectionString %>"
                SelectCommand="SELECT DISTINCT [GCfirst] FROM [GoodsCategory]"></asp:SqlDataSource>
            <asp:SqlDataSource ID="SDSGC2" runat="server" ConnectionString="<%$ ConnectionStrings:projectConnectionString %>"
                
                SelectCommand="SELECT DISTINCT [GCsecond] FROM [GoodsCategory] WHERE ([GCfirst] = @GCfirst)">
                <SelectParameters>
                    <asp:ControlParameter ControlID="ddlGCId1" Name="GCfirst" PropertyName="SelectedValue"
                        Type="String" />
                </SelectParameters>
            </asp:SqlDataSource>
            <asp:SqlDataSource ID="SDSGC3" runat="server" ConnectionString="<%$ ConnectionStrings:projectConnectionString %>"
                
                SelectCommand="SELECT DISTINCT [GCthird], [GCId], [GCfirst], [GCsecond] FROM [GoodsCategory] WHERE ([GCsecond] = @GCsecond)">
                <SelectParameters>
                    <asp:ControlParameter ControlID="ddlGCId2" Name="GCsecond" PropertyName="SelectedValue"
                        Type="String" />
                </SelectParameters>
            </asp:SqlDataSource>
            <asp:CheckBox ID="cbGCId" runat="server" Text="限制物品類別" />
            <asp:DropDownList ID="ddlGCId1" runat="server" DataSourceID="SDSGC1" DataTextField="GCfirst"
                DataValueField="GCfirst" AutoPostBack="True">
            </asp:DropDownList>
            <asp:DropDownList ID="ddlGCId2" runat="server" DataSourceID="SDSGC2" 
                AutoPostBack="True" DataTextField="GCsecond" DataValueField="GCsecond">
            </asp:DropDownList>
            <asp:DropDownList ID="ddlGCId3" runat="server" DataSourceID="SDSGC3" DataTextField="GCthird"
                DataValueField="GCId">
            </asp:DropDownList>
            <br />
            <asp:SqlDataSource ID="SDSHC" runat="server" ConnectionString="<%$ ConnectionStrings:projectConnectionString %>"
                SelectCommand="SELECT DISTINCT [HCName] FROM [HistoryCategory]"></asp:SqlDataSource>
            <asp:CheckBox ID="cbHCId" runat="server" Text="限制交易狀態" />
            <asp:DropDownList ID="ddlHCId" runat="server" DataSourceID="SDSHC" DataTextField="HCName"
                DataValueField="HCName">
            </asp:DropDownList>
            <br />
            <asp:CheckBox ID="cbMId" runat="server" Text="限制發佈者" />
            <asp:TextBox ID="tbMId" runat="server"></asp:TextBox>
            <br />
            <asp:CheckBox ID="cbWStart" runat="server" Text="限制交易時間(YYYY/MM/DD)" />
            從<asp:TextBox ID="tbWStart" runat="server"></asp:TextBox>
            到<asp:TextBox ID="tbWEnd" runat="server"></asp:TextBox>
            <br />
            <asp:CheckBox ID="cbWGAmount" runat="server" Text="限制數量" />
            &nbsp; 最少<asp:TextBox ID="tbWGAmount_min" runat="server"></asp:TextBox>
            &nbsp; 最多<asp:TextBox ID="tbWGAmount" runat="server"></asp:TextBox>
            <br />
            <asp:CheckBox ID="cbWGBrand" runat="server" Text="限制製造商" />
            <asp:TextBox ID="tbWGBrand" runat="server"></asp:TextBox>
            <br />
            <asp:CheckBox ID="cbWGBudget" runat="server" Text="限制預算" />
            &nbsp; 最少<asp:TextBox ID="tbWGBudget_min" runat="server"></asp:TextBox>
            &nbsp; 最多<asp:TextBox ID="tbWGBudget" runat="server"></asp:TextBox>
            <br />
            <asp:CheckBox ID="cbWGMadeIn" runat="server" Text="限制產地" />
            <asp:TextBox ID="tbWGMadeIn" runat="server"></asp:TextBox>
            <br />
            <asp:CheckBox ID="cbWGYear" runat="server" Text="限制產品年分" />
            &nbsp; 最小<asp:TextBox ID="tbWGYear_min" runat="server"></asp:TextBox>
            &nbsp; 最多<asp:TextBox ID="tbWGYear" runat="server"></asp:TextBox>
            <br />
            <asp:CheckBox ID="cbWTran" runat="server" Text="限制遞送方式" />
            <asp:TextBox ID="tbWTran" runat="server"></asp:TextBox>
            <br />
            <asp:Button ID="btnSearch" runat="server" Text="搜尋" />
        </div>
        <asp:SqlDataSource ID="SDSResult" runat="server" ConnectionString="<%$ ConnectionStrings:projectConnectionString %>"></asp:SqlDataSource>
        <asp:GridView ID="GVResult" runat="server" DataSourceID="SDSResult" 
            Width='100%' CellPadding="4" ForeColor="#333333" GridLines="None" 
            ShowHeaderWhenEmpty="True">
            <AlternatingRowStyle BackColor="White" />
            <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
            <SortedAscendingCellStyle BackColor="#FDF5AC" />
            <SortedAscendingHeaderStyle BackColor="#4D0000" />
            <SortedDescendingCellStyle BackColor="#FCF6C0" />
            <SortedDescendingHeaderStyle BackColor="#820000" />
        </asp:GridView>
        <br />
    </div>
</asp:Content>
